import axios from "axios"
export default {
    async getStore(key,page){
        const value=key
        const valueT=page
        const resp = await axios.get("http://localhost:3000/api/stores/all",{
            params:{
                key:value,
                page:valueT
            }
        })
        return resp.data;
    },
    async deleteStore(id){
        await axios.delete("http://localhost:3000/api/stores/"+id);
    },
    async deleteCleck(id,_id){
        const resp =await axios.put("http://localhost:3000/api/stores/emp/"+_id,{
            id:id
        });
        return resp.data
    },
    async addCleck(data,id){
        console.log(data)
        const resp =await axios.post("http://localhost:3000/api/stores/emp/"+id,data);
        return resp.data
    },
    async deleteGood(id,_id){
        const resp =await axios.put("http://localhost:3000/api/stores/good/"+_id,{
            id
        });
        return resp.data
    },
    async addGood(data,id){
        const resp =await axios.post("http://localhost:3000/api/stores/good/"+id,data);
        return resp.data
    },
    async deleteService(id,_id){
        const resp =await axios.put("http://localhost:3000/api/stores/service/"+_id,{
            id
        });
        return resp.data
    },
    async addService(data,id){
        const resp =await axios.post("http://localhost:3000/api/stores/service/"+id,data);
        return resp.data
    },
    async addStore(store){
        console.log(store)
        const resp = await axios.post("http://localhost:3000/api/stores/add", store);
        return resp.data;
    },
    async getStoreById(id){
        const resp = await axios.get("http://localhost:3000/api/stores/"+id);
        return resp.data;
    },
    async modifyStore(s){
        await axios.put("http://localhost:3000/api/stores/"+s._id, s);
    },
    async modifyState(s){
        await axios.put("http://localhost:3000/api/stores/state/"+s.id, {
            state:s.state
        });
    }
}